#pragma once

#include "Containers/Vector.h"
#include "Containers/String.h"
#include "Containers/Tuple.h"

class CBinarySerializer
{
public:
    CBinarySerializer(TVector<uint8_t>& InBinary);

    CBinarySerializer& operator << (const uint8_t & Value);
    CBinarySerializer& operator << (const uint16_t & Value); 
    CBinarySerializer& operator << (const uint32_t & Value); 
    CBinarySerializer& operator << (const uint64_t & Value);
    CBinarySerializer& operator << (const CString & Value);   
    void Append(const void* Data, uint64_t Size);

    uint64_t GetSize() const { return Binary.Num(); }
protected:
    TVector<uint8_t>& Binary;
};

class CBinaryDeserializer
{
public:
    CBinaryDeserializer(const TVector<uint8_t>& InBinary,uint64_t InOffset=0);

    CBinaryDeserializer& operator >> (uint8_t & Value);
    CBinaryDeserializer& operator >> (uint16_t & Value);
    CBinaryDeserializer& operator >> (uint32_t & Value);
    CBinaryDeserializer& operator >> (uint64_t & Value);
    CBinaryDeserializer& operator >> (CString & Value);
    void* TakeOut (uint64_t InSize);

protected:
    uint64_t Offset = 0;
    const TVector<uint8_t>& Binary;


};